package model.expression.command;


import java.util.List;

import model.expression.AbstractExpression;

import state.TabState;
import state.TurtleState;


public class Left extends AbstractCommandExpression{
	
	public Left(TabState ts) {
		super(ts);
	}
	
	@Override
	public int evaluate() {
		//Needs to modify state by the value of its children;
		int step = this.children.get(0).evaluate();
		
		//for each active turtle, evaluate
		for (Integer i : tabSt.getActiveTurtle()){
			TurtleState st= tabSt.turtlesMap.get(i);
			st.setOrientation(st.getOrientation() - step);
			st.notifyObservers();
		}
		return step;
	}


	@Override
	protected int getExpNumChildren() {
		return 1;
	}

}

